package org.assistant.common.utils;

/**
 * 配合前台ExtJS调用的实用工具
 * 
 * @author eagle
 * 
 */
public class ExtJSUtils {
	/**
	 * 获取前台Ext.form.FormPanel调用submit()提交Form时需要后台返回的JSON结果
	 * 
	 * @param result
	 * @param message
	 * @return
	 */
	public static StringBuffer getSubmitResult(boolean result, String message) {
		StringBuffer buff = new StringBuffer();
		buff.append("{");

		buff.append("success:").append(result);
		if (!result) {
			buff.append(",");
			buff.append("errors:{");
			buff.append("clientCode:").append("\"").append("Client not found").append("\"");
			buff.append("portOfLoading:").append("\"").append("This field must not be null").append("\"");
			buff.append("}");
		}

		buff.append("}");
		return buff;
	}
}
